<?php

abstract class Dao extends Model {

    /**
     * Propriedade de Acesso ao Banco de Dados
     * @var MyDb
     */
    protected $tMysqli;

    //08-06
    public function initConnection() {
        $this->tMysqli = MyDb::getInstance();
        $this->tMysqli->getConnection(MYSQL_HOST, MYSQL_USER,MYSQL_PASS, MYSQL_DB);
    }

    public function initTransaction() {
        $this->initConnection();
        $this->tMysqli->beginTransaction();
    }

    public function closeTransaction() {
        $this->tMysqli->endTransaction();
        $this->closeConnection();
    }

    public function closeConnection() {
        $this->tMysqli->close();
    }

    public function executeSql($StSql) {
        $this->initConnection();
        $tQuery = $this->tMysqli->exec($StSql);
        $this->closeConnection();
        return $tQuery;
    }

}

?>
